package com.xbongbong.paas.service;

import com.xbongbong.paas.pojo.dto.ClueAutoAllocationDetailDTO;
import com.xbongbong.paas.pojo.dto.ClueAutoAllocationListSortDTO;
import com.xbongbong.paas.pojo.dto.ClueAutoAllocationSaveDTO;
import com.xbongbong.paas.pojo.vo.ClueAutoAllocationDetailVO;
import com.xbongbong.paas.pojo.vo.ClueAutoAllocationListVO;
import com.xbongbong.paas.pojo.vo.PublicRuleItemListVO;
import com.xbongbong.paas.pojo.dto.ClueRuleDetaiDTO;
import com.xbongbong.paas.pojo.dto.ClueRuleSaveDTO;
import com.xbongbong.paas.pojo.dto.CustomerRuleSaveRemindTimeDTO;
import com.xbongbong.paas.pojo.dto.CustomerRuleUserListDTO;
import com.xbongbong.paas.pojo.dto.ReturnCustomer2PublicAsyncDTO;
import com.xbongbong.paas.pojo.vo.ClueListRuleVO;
import com.xbongbong.paas.pojo.vo.ClueRuleDetailVO;
import com.xbongbong.paas.pojo.vo.CustomerRuleRemindTimeVO;
import com.xbongbong.paas.pojo.vo.CustomerRuleUserListVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.paas.toolbox.wrap.XbbResponse;
import com.xbongbong.saas.domain.entity.ClueRuleEntity;
import com.xbongbong.sys.domain.entity.UserEntity;

import java.util.List;

public interface ClueRuleService {

    /**
     * 【web】规则列表
     *
     * @param baseDTO 获取规则入参
     * @return ClueListRuleVO
     * @throws XbbException 业务异常
     */
    XbbResponse<ClueListRuleVO> getClueRuleList(BaseDTO baseDTO) throws XbbException;

    /**
     * 【web】规则详情
     *
     * @param clueRuleDetailDTO 获取规则详情入参
     * @return CustomerRuleDetailVO
     * @throws XbbException 业务异常
     */
    XbbResponse<ClueRuleDetailVO> getClueRuleDetail(ClueRuleDetaiDTO clueRuleDetailDTO) throws XbbException;

    /**
     * 【web】保存规则
     *
     * @param clueRuleSaveDTO 保存规则入参
     * @return Integer
     * @throws XbbException 业务异常
     */
    XbbResponse<Integer> save(ClueRuleSaveDTO clueRuleSaveDTO) throws XbbException;

    /**
     * 【web】保存公海池退回提醒时间
     *
     * @param customerRuleSaveRemindTimeDTO 保存公海池退回提醒时间入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<Integer> saveRemindTime(CustomerRuleSaveRemindTimeDTO customerRuleSaveRemindTimeDTO) throws XbbException;

    /**
     * 【web】获取公海池退回提醒时间
     *
     * @param baseDTO 获取公海池退回提醒时间入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<CustomerRuleRemindTimeVO> getRemindTime(BaseDTO baseDTO) throws XbbException;

    /**
     * 【web】公海规则设置选择员工
     *
     * @param customerRuleUserListDTO 公海规则设置选择员工入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<CustomerRuleUserListVO> userList(CustomerRuleUserListDTO customerRuleUserListDTO) throws XbbException;

    /**
     * 公海规则脚本异步方法
     *
     * @param returnCustomer2PublicAsyncDTO 公海规则脚本入参
     * @return Integer
     * @throws XbbException 业务异常
     * @version v1.0
     * @since v1.0
     */
    XbbResponse<BaseVO> returnClue2PublicAsync(ReturnCustomer2PublicAsyncDTO returnCustomer2PublicAsyncDTO) throws XbbException;


    /**
     * 公海分配规则判断
     * @param corpid
     * @param userEntity
     * @param clueId
     * @param ruleList
     * @return
     * @throws XbbException 业务异常
     */
    Integer canGainClue(String corpid, UserEntity userEntity, Long clueId, List<ClueRuleEntity> ruleList, int dataIdSize) throws XbbException;

    /**
     * 更新redis中的捞取频次
     * @param corpid
     * @param userEntity
     * @throws XbbException
     */
    void updateGainRateToRedis(String corpid,UserEntity userEntity) throws XbbException;



    /**
     * 更新redis中的捞取频次
     * @param corpid
     * @param userEntity
     * @param ids
     * @throws XbbException
     */
    void updateGainRateByIds(String corpid, UserEntity userEntity, List<Long> ids) throws XbbException;


    /**
     * 动态去除线索标签
     * @param corpid
     * @param clueIds
     * @throws XbbException
     */
    void deletePublicTag(String corpid, List<Long> clueIds) throws XbbException;

    PublicRuleItemListVO clueItemList(BaseDTO baseDTO) throws XbbException;

}
